package com.beans;

import java.util.Date;

public class AdminInfo {
    private int id;
    private String password;
    private String adminName;
    private String note;

    private int roleId;
    private String roleName;  //角色名称, 数据库没有这个字段,可以通过关联查询得到

    private String state; //表示用户状态 1 正常  0 删除  2 锁定
    private Date editDate;  //最后更新时间,在数据库中是时间戳类型

    public String getstatename(){
        if ("0".equals(state)) {
            return "删除";
        }
        if("1".equals(state)){
            return "正常";
        }
        if("2".equals(state)){
            return "锁定";
        }
        return "未知";
    }
    public String shtext() {
        if(note!=null && note.length()>25) {
            return note.substring(0,25) +"...";
        }
        return note;
    }
    @Override
    public String toString() {
        return "AdminInfo{" +
                "id=" + id +
                ", password='" + password + '\'' +
                ", adminName='" + adminName + '\'' +
                ", note='" + note + '\'' +
                ", roleId=" + roleId +
                ", roleName='" + roleName + '\'' +
                ", state='" + state + '\'' +
                ", editDate=" + editDate +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAdminName() {
        return adminName;
    }

    public void setAdminName(String adminName) {
        this.adminName = adminName;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public int getRoleId() {
        return roleId;
    }

    public void setRoleId(int roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public Date getEditDate() {
        return editDate;
    }

    public void setEditDate(Date editDate) {
        this.editDate = editDate;
    }
}
